from django.db import models

# 创建模型类
# 出版社
class Publisher(models.Model):
    name = models.CharField('名称', max_length=32, default='')
    # 隐藏的属性book_set
# 图书
class Book(models.Model):
    title = models.CharField('书名', max_length=64, default='')
    # 创建一对多的映射关系，添加级联删除
    publisher = models.ForeignKey(Publisher, on_delete=models.CASCADE)
